/**
 * 
 */
package ma.moliere.presentation.util.validateurs;

import javax.faces.component.UIInput;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;

/**
 * @author SASMAMI
 * 
 */
public class PostValidationListener implements SystemEventListener {
	@Override
	public boolean isListenerForSource(final Object source) {
		return true;
	}

	public void processEvent(final SystemEvent event) throws AbortProcessingException {
		UIInput source = (UIInput) event.getSource();

		if (!source.isValid()) {
			source.getAttributes().put("styleClass", "ui-input-invalid");
		}
	}

}
